<?php
/**
 * Created by PhpStorm.
 * User: jc234839
 * Date: 20/04/14
 * Time: 11:02 AM
 */
require 'init.php';
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link href="css/main.css" rel="stylesheet" type="text/css">
    <title>Gallery</title>
    <meta name="description" content="Amazing steampunk clothing">
    <meta name="keywords" content="steampunk, tshirts, shopping">
</head>
<body>
<div id="container">
    <div id="leftCogSplash"><img src="images/cogLeft.png" alt="Left Steampunk Cog"/></div>
    <div id="rightCogSplash"><img src="images/cogRight.png" alt="Right Steampunk Cog"/></div>
    <?php include "navbar.php"; ?>
    <div id="content">
        <div id="contentFrame">
            <h2>Gallery</h2>

            <div class="gallery">
                <?php
                $sql = "SELECT P.ProductID, P.ProductName, P.UnitPrice, I.Path FROM Products AS P, Images AS I WHERE P.ProductID = I.ProductID";

                foreach ($db->query($sql) as $row) {
                    ?>
                    <div class="galleryProducts"
                         onclick="location.href='individual.php<?php echo "?productID=" . $row['ProductID']; ?>'">
                        <img src="<?php echo $row['Path'] ?>" height="285px" width="285px"
                             alt="<?php echo $row['ProductName'] ?>"/>
                        <br/>

                        <p><?php echo $row['ProductName'] . ' - $' . $row['UnitPrice'] ?></p>
                    </div>
                <?php
                }
                ?>
            </div>
        </div>
    </div>
    <?php require 'footer.php' ?>
</div>
</body>
</html>